<?php
namespace app\index\controller;
use think\Controller;
use think\Validate;
class test extends controller{
    public function index(){
        return $this->fetch();
    }
    public function write(){
    	$data['username']=input("post.username");
    	$data['password']=input("post.password");
    	$validate=new Validate([
    			'username'=>'reuired',//数组中key值为username的元素验证是否为空
    			'password'=>'reuired',
    			
    		]);
    	if(!$validate->check($data)){//验证
    		echo $validate->getError();
    	}
    }
    
}
